{extend name="base" /} {block name="css"}
<link rel="stylesheet" href="__ADMIN__/css/form.css"> {/block} {block name="body"}
<div class="admin-main layui-form">
    <div class="layui-field-box">
        <div class="layui-box-searchber">
            <form class="layui-form layui-form-pane" action="{:url('admin/point_note/index')}" method="get">
                <div class="layui-inline">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="keyword" value="{:session('pointnotekeyword')}" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn  layui-btn-sm">搜索</button>
                </div>
            </form>
        </div>
        <hr>
        <table class="layui-table admin-table">
            <thead>
                <tr>
                    <th align="center">ID</th>
                    <th align="center">用户</th>
                    <th align="center">积分</th>
                    <th align="center">操作记录</th>
                    <th align="center">记录时间</th>

                </tr>
            </thead>
            <tbody id="content">
                {volist name="tptc" id="vo"}
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.username}</td>
                    <td>{$vo.score}</td>
                    <td>{if $vo.title neq ''}{$vo.title}{else /}<a class="editalias" href="javascript:;" data-id="{$vo.rid}" title="点击修改积分别名">{$vo.controller}</a>{/if}</td>
                    <td>{$vo.add_time|friendlyDate}</td>

                </tr>
                {/volist}
            </tbody>
        </table>
    </div>


</div>
{/block} {block name="page"}
<div class="btable-paged">
    <div class="layui-main">
        {$tptc->render()}
    </div>
</div>
{/block} {block name="js"}
<script>
    layui.use('form', function() {
        var form = layui.form;
        var jq = layui.jquery;
        jq('.editalias').on('click', function() {
            var aliasname = $(this).text();
            layer.prompt({
                title: '修改积分别名' + aliasname
            }, function(val, index) {

                var url = "{:url('admin/point_note/editAlias')}";

                jq.post(url, {
                        title: val,
                        alias: aliasname
                    },
                    function(data) {

                        if (data.code == 200) {

                            layer.msg(data.msg, {
                                icon: 1,
                                time: 1000
                            }, function() {
                                location.reload();
                            });
                        } else {

                            layer.msg(data.msg, {
                                icon: 2,
                                anim: 6,
                                time: 1000
                            });
                        }
                        layer.close(index);
                    });
            })
        })


    });
</script>
{/block}